This repository was archived by the owner on Apr 29, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
refactor: export CID instances not strings or buffers #19
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This PR updates the exporter to remove the `hash` property and replace it with a `cid` property in exported objects. refs ipfs-inactive/interface-js-ipfs-core#394 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
alanshaw
added a commit
to ipfs-inactive/js-ipfs-mfs
that referenced
this pull request
Feb 27, 2019
Allows MFS to use the unixfs exporter that exports CIDs without API changes. refs ipfs-inactive/interface-js-ipfs-core#394 Depends on: * [ ] ipfs-inactive/js-ipfs-unixfs-exporter#19 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
1 task
alanshaw
added a commit
to ipfs/js-ipfs
that referenced
this pull request
Feb 27, 2019
Allows IPFS to use the unixfs exporter that exports CID instances _without_ API changes. refs ipfs-inactive/interface-js-ipfs-core#394 Depends on: * [ ] ipfs-inactive/js-ipfs-mfs#44 * [ ] ipfs-inactive/js-ipfs-unixfs-exporter#19 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
2 tasks
License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
License: MIT Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
achingbrain
approved these changes
Mar 8, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Down with strings!
alanshaw
added a commit
to ipfs/js-ipfs
that referenced
this pull request
Mar 18, 2019
Allows IPFS to use the unixfs exporter that exports CID instances _without_ API changes. refs ipfs-inactive/interface-js-ipfs-core#394 Depends on: * [ ] ipfs-inactive/js-ipfs-mfs#44 * [ ] ipfs-inactive/js-ipfs-unixfs-exporter#19 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
alanshaw
pushed a commit
to ipfs/js-ipfs
that referenced
this pull request
Mar 18, 2019
Allows IPFS to use the unixfs exporter that exports CID instances _without_ API changes. Next step is to get the unixfs importer to do the same and then make a breaking interface JS IPFS core API change to ensure we're always returning CID instances not strings for add, ls etc etc. refs ipfs-inactive/interface-js-ipfs-core#394 Depends on: * [x] ipfs-inactive/js-ipfs-mfs#44 * [x] ipfs-inactive/js-ipfs-unixfs-exporter#19 License: MIT Signed-off-by: Alan Shaw <alan@tableflip.io>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the exporter to remove the
hash
property and replace it with acid
property in yielded objects.I actually ended up doing this because there's a bug in the "raw" resolver - the objects it yields have a "hash" property not a "multihash" property like file, object and dir. This was causing problems with the CIDv1 base32 work where v1 forces raw leaves and we start using that raw resolver which obviously then gives us back
undefined
when accessing the "multihash" prop.That file probably needs more/better tests.EDIT: added a testThe upshot is that I solve that issue, as well as make progress towards ipfs-inactive/interface-js-ipfs-core#394 and hopefully make some performance gains by not having to do so much conversion between string/buffer/CID. Hooray!